home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SampleSNMPAgent.h
-
- Contains: Declaration for SampleSNMPAgent
-
- Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #ifndef __SAMPLESNMPAGENT__
- #define __SAMPLESNMPAGENT__
-
- #ifndef __SNMP__
- #include "SNMP.h"
- #endif
-
- #ifndef __TSNMP__
- #include "TSNMP.h"
- #endif
-
- /*
- Structures representing groups and variables in the variable description resource.
- This resource contains all the information about the variables and groups that
- an agent supports. The resource also contains variable description strings
- used by the MacSNMP setup application. See the file SNMPTypes.r
- Below are structures for the resource header, groups, indirect variables,
- and direct variables. For more information on indirect and direct variables,
- see the main program code SampleAgent.cp
- */
-
- // type and id of the variable description resource.
- #define kVarRsrcType 'vard' // variable description resource type
- #define kVarRsrcID 128 // variable description resource id
-
- #define kOurVersion 1 // version of this agent used for registration
-
-
- // group resource structure
-
- typedef struct {
- unsigned short strIndex; // group string index
- ObjectID objID; // group object id
- }
- GroupRsrc;
-
- typedef GroupRsrc *GroupRsrcPtr;
-
- // structure for the resource header
-
- typedef struct {
- short namesResID; // name strings resource id
- short descResID; // description strings resource id
- short agentStrIndex; // agent string index
- short groupCount; // first group resource
- }
- VarDescRsrc;
-
- typedef VarDescRsrc *VarDescRsrcPtr;
-
-
- // variable resourc structure
-
- typedef struct {
- unsigned short strIndex; // string index
- ASNTagType type; // asn type
- short access; // access
- short dataSize; // size of variable
- short ptrIndex; // index to array holding ptr to var or function
- long varType; // type of var - 0 = indirect, 1 = direct
- ObjectID objID; // object id
- }
- VarRsrc;
-
- typedef VarRsrc *VarRsrcPtr;
-
- // typedefs for get and set callback functions
-
- typedef OSErr
- GetVarProc (
- Boolean next, // is it get or the powerful get-next?
- ObjectIDPtr id, // unique identifier of a variable
- Ptr bufPtr, // where to return the variable's value
- Size bufSize, // size of buffer to fill
- Size *bufUsed); // size of value returned
-
- typedef GetVarProc *GetVarProcPtr;
-
- typedef OSErr
- SetVarProc (
- ObjectIDPtr id, // unique identifier of a variable
- Ptr bufPtr, // value for the variable
- Size bufSize, // size of the value
- SetStage action ); // ensuring simultaneous sets
-
- typedef SetVarProc *SetVarProcPtr;
-
- /*************************************************************************
- TSampleSNMPagent Class
- *************************************************************************/
-
- #define kTSampleSNMPAgentID "snmp:agt$TSampleSNMPAgent"
-
- class TSampleSNMPAgent : public TSNMPAgent {
-
- public:
- TSampleSNMPAgent();
- virtual ~TSampleSNMPAgent();
- virtual Boolean IsValid() const; // returns valid or not valid state of
- // agent - set by contructor
- private:
- Boolean fValid; // agent valid flag - set in contructor
- Boolean fRegistered; // agent registered flag - set in constructor
- };
-
- #endif __SAMPLESNMPAGENT__
-